<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <title><g:message code="job.nav.create"/></title>
</head>
<body>
<div class="nav">
    <span class="menuButton"><g:link class="list" action="list"><g:message code="job.nav.list"/></g:link></span>
</div>
<div class="body">
    <h1><g:message code="job.nav.create"/></h1>
    <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${jobInstance}">
        <div class="errors">
            <g:renderErrors bean="${jobInstance}" as="list"/>
        </div>
    </g:hasErrors>
    <g:form action="save" method="post">
        <div class="dialog">
            <table>
                <tbody>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="customer"><g:message code="job.table.customer"/>:</label>
                    </td>
                    <td valign="top" class="value">
                        <g:select optionKey="id" from="${Customer.get(params.'customer.id')}" readonly="true" name="customer.id" value="${params.'customer.id'}"></g:select>
                    </td>
                </tr>

                %{--<tr class="prop">--}%
                    %{--<td valign="top" class="name">--}%
                        %{--<label for="date"><g:message code="job.table.date"/>:</label>--}%
                    %{--</td>--}%
                    %{--<td valign="top" class="value ${hasErrors(bean: jobInstance, field: 'date', 'errors')}">--}%
                        %{--<g:datePicker name="date" value="${jobInstance?.date}"></g:datePicker>--}%
                    %{--</td>--}%
                %{--</tr>--}%

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="status"><g:message code="job.table.status"/>:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean: jobInstance, field: 'status', 'errors')}">
                        <g:ifAnyGranted role="ROLE_ADMIN">
                            <g:select name="status" value="${jobInstance.status}" from="${Constants.JOB_STATUS_LIST}"/>
                        </g:ifAnyGranted>
                        <g:ifNotGranted role="ROLE_ADMIN">
                            <input type="text" class="readonly" readonly name="status" value="${fieldValue(bean: jobInstance, field: 'status')}"/>
                        </g:ifNotGranted>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="originalValue"><g:message code="job.table.original.value"/>:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean: jobInstance, field: 'originalValue', 'errors')}">
                        <input type="text" id="originalValue" name="originalValue" value="${fieldValue(bean: jobInstance, field: 'originalValue')}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="discount"><g:message code="job.table.discount"/>:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean: jobInstance, field: 'discount', 'errors')}">
                        <input type="text" id="discount" name="discount" value="${fieldValue(bean: jobInstance, field: 'discount')}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="value"><g:message code="job.table.value"/>:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean: jobInstance, field: 'value', 'errors')}">
                        <input type="text" id="value" name="value" value="${fieldValue(bean: jobInstance, field: 'value')}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="actualValue"><g:message code="job.table.actual.value"/>:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean: jobInstance, field: 'actualValue', 'errors')}">
                        <input type="text" id="actualValue" name="actualValue" value="${fieldValue(bean: jobInstance, field: 'actualValue')}"/>
                    </td>
                </tr>

                </tbody>
            </table>
        </div>
        <div class="buttons">
            <span class="button"><input class="save" type="submit" value="${message(code: 'common.button.save')}"/></span>
        </div>
    </g:form>
</div>
</body>
</html>
